<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<html>
	<head>
		<meta http-equiv="Content-Language" content="zh-cn">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>SSH新闻发布</title>
	</head>
	<body>
		<center>
			<h3>
				管理新闻
			</h3>
			<div align="left"><a href="./logout.do">退出登录</a></div>
			<c:forEach items="${requestScope['admin.username']}" var="admin">
			<h4>欢迎管理员<c:out value="${admin}" />登陆</h4>
			</c:forEach>
			<br>
			<a href="./addNews.jsp">添加新闻</a>
			<br>
			<a href="./admin/addAdmin.jsp">添加管理员</a>
			<br>
			<a href="./AdminPage.do?pno=1">查看管理员</a>
			<br>
			<table border="2" width="600">
				<tr>
					<td>
						标题
					</td>
					<td>
						作者
					</td>
					<td>
						时间
					</td>
					<td>
						内容
					</td>
					<td>
						查看
					</td>
					<td>
						管理
					</td>
				</tr>
						<c:forEach items="${requestScope['NewsList']}" var="Sshnews">
					<tr>
							<td>
								<c:out value="${Sshnews.title}" />
							</td>
							<td>
								<c:out value="${Sshnews.author}" />
							</td>
							<td>
								<c:out value="${Sshnews.date}" />
							</td>
							<td>
								<c:out value="${Sshnews.content}" />
							</td>
							<td>
								<a href="./getNews.do?id=<c:out value="${Sshnews.id}"/>">查看详细</a>
							</td>
							<td>
								<a href="./editNews.do?id=<c:out value="${Sshnews.id}"/>">修改</a>
								&nbsp;&nbsp;
								<a href="./deleteNews.do?id=<c:out value="${Sshnews.id}"/>" onclick="javascript:return confirm('您确定删除吗？')">删除</a>
							</td>
					<tr>
						</c:forEach>
			</table>
			<table align="center" width="500">
    <tr>
       <td align="center" colspan="10">
          <logic:present name="myPage">
            <html:link page="/NewsPage2.do?pno=1">首页</html:link>
          <logic:equal name="myPage" property="hasPreviousPage" value="false">上一页</logic:equal>
          <logic:equal name="myPage" property="hasPreviousPage" value="true">
           <a href="./NewsPage2.do?pno=<bean:write name="myPage" property="prePage"/>">上一页</a>
      </logic:equal>
           
           每页<bean:write name="myPage" property="pageSize"/>条记录
           共<bean:write name="myPage" property="rowCount"/>条记录
                当前第(<bean:write name="myPage" property="currentPage"/>/<bean:write name="myPage" property="totalPage"/>)页
        <logic:equal name="myPage" property="hasNextPage" value="false">下一页</logic:equal>
        <logic:equal name="myPage" property="hasNextPage" value="true">
         <a href="./NewsPage2.do?pno=<bean:write name="myPage" property="nextPage"/>">下一页</a>
        </logic:equal>
           <a href="./NewsPage2.do?pno=<bean:write name='myPage' property='totalPage'/>">末页</a>
        </logic:present>
      </td>
      </tr>
    </table>
		</center>
	</body>
</html>
